<%@ page language="java" import="java.util.*,java.text.SimpleDateFormat,cn.bupt.adt.constant.Constants" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ page  isELIgnored="false"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String ip = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+"/";
%>
<%
	//分页
	//currentPage就是当前页，allPages表示的就是一共有多少页。这些在后面都会用到  
	int currentPage = 0, allPages = 0;
	if (request.getAttribute("currentPage") != null) {
		currentPage = Integer.parseInt(request.getAttribute(
				"currentPage").toString());
	}
	if (request.getAttribute("allPages") != null) {
		allPages = Integer.parseInt(request.getAttribute("allPages")
				.toString());
	}
	//本页面url，翻页用
	String url = "carouselManagement/index";
	request.setAttribute("url", url);
	request.setAttribute("imageRootPath",ip+Constants.IMAGE_PATH);
%>
<!DOCTYPE html>
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title></title>
    

	<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
	<meta name="viewport" content="width=device-width,height=device-height,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
	<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/bootstrap.min.css" />

    <link href="<%=request.getContextPath()%>/assets/css/font-awesome.css" rel="stylesheet" />
    <link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css' />
     <link rel="stylesheet" href="css/Orderfont.css"><link>
	<script src="<%=request.getContextPath()%>/assets/js/jquery-1.10.2.js" type="text/javascript"></script>
	<script type="text/javascript" src="js/public/buttonModal.js"></script>
	  </head>
  <c:if test="${!empty oper_message }">
  	<script type="text/javascript">
  		alert("${oper_message}");
  	</script>
  </c:if>

  <body>
  	<div class="container">
  	<div class="page-header">
		  		<h1><small>轮播图<i class="icon-double-angle-right"></i></small></h1>
			</div>
	<div class="table-responsive">
		<table class="table table-striped table-hover ">
			<thead class="table-header">
				<tr class="center">
					<th>序号</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody class="center">
			<c:forEach items="${carousels}" var="item" varStatus="sta">
			                                    <%--执业证照片 --%>                                      
										<div id="pic${sta.index }" class="modal fade">
								      		<div class="modal-dialog " >
								      			<div class="modal-content">
								      				<div class="modal-header">
								      					 <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> 
								      				</div>
								      				<div class="modal-body">
									      				<div>
									      					<img alt="轮播图片" src="${imageRootPath}${item.src}" style="height: 100%;width: 100%">
									      				</div>
								      				</div>
								      			</div>
								      		</div>
										</div>
				<tr class="center">
					<td>${item.id}</td>
					<td>
					<button id="btn-pic${sta.index }" class="btn btn-info">查看</button>
					<a class="btn btn-info" href="carouselManagement/modifyCarousel/${item.id }">修改</a>
					<%-- <a href="doctorManagement/deleteOperationType/${item.id}" title="删除此类型" onclick="return confirm('确认要删除该手术类型吗？');"><i class="fa fa-fw fa-minus"></i></a> --%>
					</td>
				</tr>			
				<script type="text/javascript">
					clickButtonToModal("btn-pic${sta.index}","pic${sta.index}");
				</script>
			</c:forEach>

			</tbody>
				<tr>
					<td colspan="50" style="text-align:left">
			     	<c:if test="${allPages>1}">
			     	<ul class="pagination">
			     		<li ><a href="${url}/1">首页</a></li>
			     		<li><a href="javascript:void(0)" id="previous" onclick="dividePage('${url}','previous')">&laquo;</a></li>
			     		<c:forEach var="item" begin="1" end="${allPages }" varStatus="idx">
						  	<c:choose>
						  		<c:when test="${idx.index == currentPage }">
						  			<li class="active"><a href="javascript:void(0)" id="active">${idx.index}</a></li>
						  		</c:when>
						  		<c:otherwise>
						  			<li><a href="${url}/${idx.index}">${idx.index}</a></li>
						  		</c:otherwise>
						  	</c:choose>
						  </c:forEach>
					      <li><a href="javascript:void(0)" id="next" onclick="dividePage('${url}','next','${allPages}')">&raquo;</a></li>
			     			<li ><a href="${url}/${allPages}">尾页</a></li>
					</ul>			     	
			     	</c:if>
			     	
					
					</td>
				</tr>
			<tfoot>
<!-- 			<tr>
				<td><button class="btn btn-primary" onclick="" id="tianjia">添加手术类别</button></td>
			</tr> -->
			</tfoot>
      </table>
      <div id="myModal" class="modal fade">
      		<div class="modal-dialog">
      			<div class="modal-content">
      				<div class="modal-header">
      					<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
      					<h4 class="modal-title">请输入要添加的手术类型</h4>
      				</div>
      				<div class="modal-body">
      					<form action="doctorManagement/addOperationType" method="post" id="form">
      						<input type="text" name="operationTypeName" id="operationTypeName" class="form-control" placeholder="请输入手术类型">
      						<input type="radio" name="flag" value="false" checked="">非认证类
      						<input type="radio" name="flag" value="true" checked="checked">认证类
      					</form>
      				</div>
      				<div class="modal-footer">
      					<button type="button" class="btn btn-primary" id="sub">确认</button>
      					<button type="button" class="btn btn-primary" data-dismiss="modal">取消</button>
      				</div>
      			</div>
      		</div>
      </div>
	</div>
	</div>
	<script src="assets/js/bootstrap.js"></script>
	<script type="text/javascript" src="js/public/dividePage.js"></script>
	<script type="text/javascript" src="js/public/operationType/submitForm.js"></script>
<!-- 	<script type="text/javascript">
		submitFormByButton("sub","form","operationTypeName");

		$("#tianjia").click(function(){
			$('#myModal').modal('toggle');
		});

	</script> -->

  </body>
</html>